<template>
	<view v-if="note" class="box">
		<view class="title">
			<h4>
				{{note.title}}
			</h4>
		</view>
		<view class="info row">
			<view style="margin-right: 20rpx;">{{note.nickName}}</view>
			<view>{{note.addTime}}</view>
		</view>
		<view class="content">
			<rich-text :nodes="note.content"></rich-text>
		</view>
	</view>
</template>

<script>
	import tools from '../../tools';
	import { BASE_IP } from '@/common/http/url.js'
	export default {
		data() {
			return {
				user: null,
				note: null,
			}
		},
		onLoad(e) {
			this.id = e.id;
			this.user = uni.getStorageSync("user");
			this.getData();
		},
		methods: {
			getData() {
				uni.request({
					header: { "Authorization": this.user.token },
					method: "GET",
					url: BASE_IP + "pc/note/get/" + this.id,
					success: (res) => {
						console.log("详情：", res.data)
						if (res.statusCode == 200) {
							this.note = res.data;
							this.note.content = this.note.content.replace(/\n/g, '<br/>');
						}
					}
				})
			},


		}
	}
</script>

<style>
	.box {
		width: 90%;
		height: auto;
		margin: auto;
	}

	.title {
		font-weight: bold;
		margin: 20rpx 0;
	}

	.info {
		margin: 20rpx 0;
	}

	.content {}
</style>